import fs from "fs";

function getFile(fpath) {
  return new Promise((resolve, reject) => {
    fs.readFile(fpath, "utf8", (err, result) => {
      if (err) return reject(err);
      resolve(result);
    });
  });
}

getFile("./data/a.txt")
  .then((r1) => {
    console.log(r1);
  })
  .catch((err) => console.log(err.message));
